package com.huya.demo.minio.controller;

import com.huya.demo.minio.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 基础控制器
 *
 * @author huya
 * @date 2025-01-10
 */
@Controller
public class BasicController {

    // http://127.0.0.1:8080/hello?name=huya
    @RequestMapping("/hello")
    @ResponseBody
    public String hello(@RequestParam(name = "name", defaultValue = "unknown user") String name) {
        return "Hello " + name;
    }

    // http://127.0.0.1:8080/user
    @RequestMapping("/user")
    @ResponseBody
    public User user() {
        User user = new User();
        user.setName("huya");
        user.setAge(18);
        return user;
    }

}
